const Service = require('egg').Service;

class TipsService extends Service {
  async random() {

    const result = await this.ctx.app.mysql.query('SELECT * FROM tips WHERE id >= ((SELECT MAX(id) FROM tips)-(SELECT MIN(id) FROM tips)) * RAND()+(SELECT MIN(id) FROM tips) LIMIT 1');
    let res=result[0];
		return res
	}


}

module.exports = TipsService;